<template>
  <div>
    御剑乘风来,除魔天地间!
    <el-table :data="tableData" style="width: 100%">
      <el-table-column type="index" label="索引" width="30"> </el-table-column>
      <el-table-column label="序号" width="50">
        <template slot-scope="{ $index }">
          {{ $index + 1 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="日期123" width="180">
      </el-table-column>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
      <el-table-column label="性别">
        <template slot-scope="{ row }">
          {{ row.gender === 1 ? '男' : '女' }}
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <!-- <el-button type="danger">删除</el-button> -->
        <!-- <template slot-scope="scope"> -->
        <template slot-scope="{ row, $index }">
          <!-- <pre>{{ scope.row.address }}</pre> -->
          <pre>{{ row }}==={{ $index }}</pre>
          <el-button type="danger">删除</el-button>
          <el-button type="success">添加</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 有图片的表格 -->
    <el-table border :data="tableData2" style="width: 100%">
      <el-table-column type="index" label="序号" width="30"> </el-table-column>
      <el-table-column prop="companyName" label="姓名" width="180">
      </el-table-column>
      <el-table-column prop="companyLogo" label="logo">
        <template slot-scope="{ row }">
          <img :src="row.companyLogo" alt="" />
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-pagination
      layout="sizes,prev, pager, next,jumper,total,slot"
      :total="50"
      :page-sizes="[2, 6, 8, 10, 20]"
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    >
      ====web67
    </el-pagination>
  </div>
</template>
           
<script>
export default {
  data() {
    return {
      tableData: [
        {
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄',
          gender: 1, //  0=》女   1=》男
        },
        {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄',
          gender: 1,
        },
        {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄',
          gender: 0,
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄',
          gender: 0,
        },
        {
          date: '2016-05-06',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1511 弄',
          gender: 0,
        },
      ],

      tableData2: [
        {
          companyName: '小米',
          companyLogo: 'http://s02.mifile.cn/assets/static/image/logo-mi2.png',
        },
        {
          companyName: '京东',
          companyLogo: 'https://misc.360buyimg.com/lib/img/e/logo-201305-b.png',
        },
        {
          companyName: '百度',
          companyLogo:
            'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
        },
      ],
    }
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    },
  },
}
</script>
<style lang='less'  scoped>
img {
  width: 200px;
  height: 200px;
}
</style>